Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

launch4j: use heap config from applicationDefaultJvmArgs #2218

Merged
merged 1 commit into from
Jul 20, 2024

Conversation

jpstotz
Copy link
Collaborator

@jpstotz jpstotz commented Jul 19, 2024

launch4j: use heap config from applicationDefaultJvmArgs - do not let launch4j overwrite it.

It seems like maxHeapPercent calculation uses the free RAM as basis for it's calculation. As we already have a working heap configuration -Xms128M -XX:MaxRAMPercentage=70.0 in applicationDefaultJvmArgs I think it is better keep this and do not let launch4j reconfigure the heap size. This would also improve consistency between the launch scripts and launch4j exe launcher.

fixes #2217

@skylot
Copy link
Owner

skylot commented Jul 19, 2024

It seems like maxHeapPercent calculation uses the free RAM as basis for it's calculation

For me, this looks like a good thing, because if we set max heap size bigger than system free memory and JVM will try to expand heap to this maximum value it will crash with segfault. Also, now jadx-gui monitor memory usage and take actions if it is close to max size (like reducing processing threads count and forcing GC run). So, be close to max heap size is better than crash. Anyway, free system memory can change over time, so such solution is also not ideal.

Another option is to try to monitor both java and system memory usage at the same time, so it will be possible to better handle low memory states. I will check if this possible and how to do this 🙂

@jpstotz
Copy link
Collaborator Author

jpstotz commented Jul 20, 2024

For me, this looks like a good thing, because if we set max heap size bigger than system free memory and JVM will try to expand heap to this maximum value it will crash with segfault.

A Windows system crashing with segfault? Windows systems should always have page file that prevents crashes because of out of memory situations. System speed may go down because of frequent in/out paging operations so user can decide which process should be killed to restore normal operations.

@skylot
Copy link
Owner

skylot commented Jul 20, 2024

A Windows system crashing with segfault?

JVM will crash, not system. And sure, page file will help.
Ok, assuming most systems have enabled page file/swap, it is safe to merge this PR.

Also, I found oshi library which can query system free/available memory, so it is possible to monitor system memory usage to improve jadx-gui operations on low memory.

@skylot skylot merged commit a8d889d into skylot:master Jul 20, 2024
5 checks passed
@jpstotz jpstotz deleted the launch4j_heap branch July 21, 2024 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature] Is it possible to set the running RAM of jadx-gui at a fixed value
2 participants